Conversation
Initial draft courtesy of `monkeytype`: ```shell .venv/bin/uv pip install -e plone.base[test] monkeytype zope.testrunner monkeytype run .venv/bin/zope-testrunner --path plone.base/src/ for module in `monkeytype list-modules`; do monkeytype apply $module || true > /dev/null;done ```
|
@ale-rt thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
|
@jenkins-plone-org please run jobs |
thet
left a comment
There was a problem hiding this comment.
Since we're supporting Python >= 3.10 we can use some built-in types for hinting and other idioms. The code should get reworked using those.
maybe there is a Python target version setting for monkeytyping?
| @@ -1,3 +1,4 @@ | |||
| # mypy: disable-error-code=misc | |||
There was a problem hiding this comment.
Do we really need this?
Also, mypy is just one of the type checkers - I'd avoid picking and configuring one.
Maybe there is a global config, so that we do not have to repeat this for every module, where some typing errors occur.
| from plone import schema | ||
| from plone.base import PloneMessageFactory as _ | ||
| from Products.CMFCore.utils import getToolByName | ||
| from typing import Dict |
There was a problem hiding this comment.
Not necessary anymore.
Since Python 3.9 we an use built in types like tuple, list and dict as generic types for type hinting.
|
|
||
| @contextmanager | ||
| def use_locale(value=None): | ||
| def use_locale(value: Optional[str] = None) -> Iterator[Union[str, bool]]: |
There was a problem hiding this comment.
Since Python 3.10 this can be written as:
from collections.abc import Iterator
def use_locale(value: str | None = None) -> Iterator[str | bool]:
# ...existing code...
Initial draft courtesy of
monkeytype:If your pull request closes an open issue, include the exact text below, immediately followed by the issue number. When your pull request gets merged, then that issue will close automatically.
Closes #